package moc.egg;
import moc.compiler.*;
import moc.tds.*;
import moc.type.*;
import moc.gc.*;
import java.util.*;
import mg.egg.eggc.runtime.libjava.lex.*;
import mg.egg.eggc.runtime.libjava.*;
import mg.egg.eggc.runtime.libjava.messages.*;
import mg.egg.eggc.runtime.libjava.problem.IProblem;
import java.util.Vector;
public class S_E_MOC {
LEX_MOC scanner;
  S_E_MOC() {
    }
  S_E_MOC(LEX_MOC scanner, boolean eval) {
    this.scanner = scanner;
    this.att_eval = eval;
    this.att_scanner = scanner;
    }
int [] sync= new int[0];
  boolean att_gauche;
  boolean att_eval;
  String att_code;
  IMachine att_machine;
  DTYPE att_type;
  TDS att_tds;
  LEX_MOC att_scanner;
  private void regle69() throws Exception {

    //declaration
    T_MOC x_2 = new T_MOC(scanner ) ;
    T_MOC x_4 = new T_MOC(scanner ) ;
    S_F_MOC x_5 = new S_F_MOC(scanner,att_eval) ;
    T_MOC x_6 = new T_MOC(scanner ) ;
    //appel
if  (att_eval)      action_auto_inh_69(x_5);
    x_2.analyser(LEX_MOC.token_libere);
if  (att_eval)      action_sens_69(x_5);
    x_4.analyser(LEX_MOC.token_paro);
    x_5.analyser() ;
    x_6.analyser(LEX_MOC.token_parf);
if  (att_eval)      action_code_69(x_5);
  }
  private void regle29() throws Exception {

    //declaration
    S_A_MOC x_2 = new S_A_MOC(scanner,att_eval) ;
    S_AFFX_MOC x_4 = new S_AFFX_MOC(scanner,att_eval) ;
    //appel
if  (att_eval)      action_auto_inh_29(x_2, x_4);
    x_2.analyser() ;
if  (att_eval)      action_htype_29(x_2, x_4);
    x_4.analyser() ;
if  (att_eval)      action_code_29(x_2, x_4);
  }
private void action_auto_inh_29(S_A_MOC x_2, S_AFFX_MOC x_4) throws Exception {
try {
// instructions
x_2.att_tds=this.att_tds;
x_4.att_tds=this.att_tds;
x_2.att_gauche=this.att_gauche;
x_2.att_machine=this.att_machine;
x_4.att_machine=this.att_machine;
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#auto_inh","E -> A #htype AFFX #code ;"});
}
  }
private void action_htype_29(S_A_MOC x_2, S_AFFX_MOC x_4) throws Exception {
try {
// instructions
x_4.att_decl=false;
x_4.att_htype=x_2.att_type;
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#htype","E -> A #htype AFFX #code ;"});
}
  }
private void action_sens_69(S_F_MOC x_5) throws Exception {
try {
// instructions
x_5.att_gauche=false;
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#sens","E -> libere #sens paro F parf #code ;"});
}
  }
private void action_auto_inh_69(S_F_MOC x_5) throws Exception {
try {
// instructions
x_5.att_tds=this.att_tds;
x_5.att_machine=this.att_machine;
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#auto_inh","E -> libere #sens paro F parf #code ;"});
}
  }
private void action_code_29(S_A_MOC x_2, S_AFFX_MOC x_4) throws Exception {
try {
// instructions
if ((x_4.att_stype.equals(x_2.att_type))){
this.att_type=x_2.att_type;
this.att_code=x_4.att_code+x_2.att_code;
}
else {
att_scanner._interrompre(IProblem.Semantic, att_scanner.getBeginLine(), IMOCMessages.id_Type_non_conformes, MOCMessages.Type_non_conformes,new Object[]{""+x_2.att_type.toString(), ""+x_4.att_stype.toString()});

}
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#code","E -> A #htype AFFX #code ;"});
}
  }
private void action_code_69(S_F_MOC x_5) throws Exception {
try {
// instructions
if (x_5.att_type instanceof POINTEURTYPE ){
this.att_type= new VOIDTYPE();
this.att_code=";"+x_5.att_code+";SUBR MFree; instruction qui bug \n";
}
else {
att_scanner._interrompre(IProblem.Semantic, att_scanner.getBeginLine(), IMOCMessages.id_free_impossible, MOCMessages.free_impossible,new Object[]{""+x_5.att_type.toString()});


}
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#code","E -> libere #sens paro F parf #code ;"});
}
  }
  public void analyser () throws Exception {
    scanner.lit ( 1 ) ;
    switch ( scanner.fenetre[0].code ) {
      case LEX_MOC.token_entier : // 3887
        regle29 () ;
      break ;
      case LEX_MOC.token_chaine : // 3889
        regle29 () ;
      break ;
      case LEX_MOC.token_caractere : // 3888
        regle29 () ;
      break ;
      case LEX_MOC.token_plus : // 3875
        regle29 () ;
      break ;
      case LEX_MOC.token_moins : // 3876
        regle29 () ;
      break ;
      case LEX_MOC.token_non : // 3882
        regle29 () ;
      break ;
      case LEX_MOC.token_null : // 3867
        regle29 () ;
      break ;
      case LEX_MOC.token_paro : // 3852
        regle29 () ;
      break ;
      case LEX_MOC.token_ident : // 3890
        regle29 () ;
      break ;
      case LEX_MOC.token_mult : // 3878
        regle29 () ;
      break ;
      case LEX_MOC.token_new : // 3883
        regle29 () ;
      break ;
      case LEX_MOC.token_libere : // 3884
        regle69 () ;
      break ;
      default :
               scanner._interrompre(IProblem.Syntax, scanner.getBeginLine(), IMOCMessages.id_MOC_unexpected_token,MOCMessages.MOC_unexpected_token,new String[]{scanner.fenetre[0].getNom()});
    }
  }
  }
